package logic.studentQuery_logic;

import java.util.List;
import javaRMI.RMIClient;

import logic.utility_logic.CourseQueryLogicsvFactory;
import logicsv.courseQuery_logicsv.CourseQueryLogicsv;
import po.StuCouScoRecPO;
import po.StudentPO;
import resultmessage.StudentQueryRM;
import vo.CourseVO;
import vo.StudentVO;
import datasv.datafactorysv.StudentQueryDatasvFactory;
import datasv.studentQuery_datasv.StudentQueryDatasv;

public class CollegeStudentList {
	private StudentQueryDatasv studentQD;
	private CourseQueryLogicsv courseQL;
	private String collegeID;
 CollegeStudentList(RMIClient rmi,String collegeID) {
		super();
		this.collegeID = collegeID;
		studentQD = new StudentQueryDatasvFactory(rmi).create();
		courseQL = new CourseQueryLogicsvFactory(rmi).create();
	}
 	public StudentVO getStudent(String studentID){
 		StudentPO student = studentQD.getStudent(studentID);
 		List<CourseVO> courses = courseQL.getAllCouOfStu(studentID);
 		List<StuCouScoRecPO> scores = courseQL.getCourses(studentID);
 		return new StudentVO(student,courses,scores);
 	} 	
	 public List<String> getStudentList() {
		 return studentQD.getCollegeStudents(collegeID);
	 }
	public StudentQueryRM addStudent(StudentPO student){
		StudentQueryRM re = 	studentQD.addStudent(student);
			return re;
	 }
	 public StudentQueryRM updateStudent(StudentPO student){
		 StudentQueryRM re = studentQD.updateStudent(student);
		  return re;
	 }
	 public StudentQueryRM deleteStudent(String studentID){
		 StudentQueryRM re =  studentQD.deleteStudent(studentID);
		 return re;
	 }
}
